import json

# 加载 Swagger JSON 文件



def load_swagger(file_path):
    with open(file_path, encoding='utf-8') as f:
        return json.load(f)

# 提取接口信息
def get_api_endpoints(swagger_json):
    endpoints = []
    for path, methods in swagger_json.get('paths', {}).items():
        for method, details in methods.items():
            endpoint = {
                'name':details.get('summary', []),
                'path': path,
                'method': method,
                'parameters': details.get('parameters', []),
                'responses': details.get('responses', {})
            }
            endpoints.append(endpoint)
    return endpoints

file_path='./default_OpenAPI.json'
swagger_json=load_swagger(file_path)
endpoints=get_api_endpoints(swagger_json)
print(endpoints)

